﻿@model ElectrosLTD.Models.ProductModel

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type ="text/javascript">

    function Add() {
            
        var id = '@Html.DisplayFor(model => model.productID)';
        //var purchasedStock = 'Html.DisplayFor(model => model.purchasedStock)';
        //var varb = id+","+purchasedStock
        $.post("/Product/AddToCart", { productID: id });
         

</script>

<h2>Details</h2>

<fieldset>
    <legend>ProductModel</legend>

    <div class="display-label">Product:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.productName)
    </div>

    <div class="display-label">Image:</div>
    <div class="display-field">
       <img src="@Html.DisplayFor(model => model.Image)" alt="" width= "100px" height ="100px" />
    </div>

    <div class="display-label">Features:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Features)
    </div>

    <div class="display-label">Stock:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Stock)
    </div>

    <div class="display-label">Price:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Price)
    </div>

    <div class="display-label">Average Rating:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Averagerating)
    </div>

    <div class="display-label">Number of Ratings:</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.noOfRatings)
    </div>
</fieldset>
<p>
    @if (Request.IsAuthenticated == true)
    {
        <a id="AddToCart" href="" onclick="Add();">Add To Cart</a><label>  |  </label>
    }
    @Html.ActionLink("Back to List", "Index")
</p>

<fieldset>
<legend>Comments</legend>

@Html.Action("Comments", "Partial", new { ProductId = Model.productID })
</fieldset>
